package com.pphh.demo.common.config;

import com.pphh.demo.common.TraceRegister;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class TraceConfig {

    @Value("${spring.application.name:unknown-app}")
    private String appName;

    @Value("${trace.sampler.sampling-rate:0.1}")
    private Double samplingRate;

    @PostConstruct
    private void init(){
        TraceRegister.initTracer(appName, samplingRate);
    }
}
